<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <link href="https://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <div class="container">
            <div class="row clearfix">
                <div class="col-md-12 column">
                    <h1 class="text-center">
                        欠款提醒
                    </h1>

                        <div class="container">
                            <div class="row clearfix">
                                <div class="col-md-12 column">
                                    <div class="row clearfix">
                                        <div class="col-md-2 column">
                                        </div>
        <div class="col-md-6 column">
            <form class="form-horizontal" role="form" id="form">
                <input type="hidden" name="did" value="${debt.did}">
                <div class="form-group">
                    <label for="repaymentDate" class="col-sm-2 control-label">清欠日期</label>
                    <div class="col-sm-10">
                        <input type="date" class="form-control" id="repaymentDate"
                               name="repaymentDate"/>
                    </div>
                </div>

                <div class="form-group">
                    <label for="oweMax" class="col-sm-2 control-label">最大欠款额度</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="oweMax"
                               name="oweMax" value="${debt.oweMax?c}" readonly/>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="button" class="btn btn-success"
                                onclick="addItem()">提交</button>
                        &nbsp;&nbsp;&nbsp;
                        <button type="submit" class="btn btn-success"
                                onclick="history.back()">返回</button>
                    </div>
                </div>
            </form>
        </div>
            <div class="col-md-4 column">
            </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <script src="/static/js/jquery-1.8.0.min.js" ></script>
        <script>
            // 欠款提醒
            function addItem(){
                // var date=$("#repaymentDate").val();
                // if (date==null){
                //     alert("请选择清欠日期！");
                //     return;
                // }

                //1. 获取form表单中的全部内容
                var data = $("#form").serialize(); // 将携带name属性的表单项拼接为key=value&key=value..
                //2. 发送ajax请求到后台,并传递全部的参数.
                $.post(
                    "/debt/warn",
                    data,
                    function(result){
                        if(result.code == 0){
                            alert("设置成功")
                            location.href="/debt/list";
                        }
                        else {
                            alert(result.msg);
                        }
                    },
                    "json"
                );
            }


        </script>
    </body>
</html>